import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;

import java.net.URI;

public class FileList {
    public static void main(String[] args) throws Exception {
        if (args.length != 1) {
            System.err.println("Usage: FileList <source>");
            System.exit(2);
        }
        Configuration conf = new Configuration();
        FileSystem fs = FileSystem.get(URI.create(args[0]), conf);
        FileStatus[] statuses = fs.listStatus(new Path(args[0]));
        Path[] listedPaths = FileUtil.stat2Paths(statuses);
        for (Path path : listedPaths) {
            System.out.println(path);
        }
    }
}
